<?php
/**
 * Admin_Form_AddResource - Formulář pro přídání zdroje (možné využití i pro editaci)
 *
 * @author Petr Laslo
 * @license MIT License
 * @package Knihovna\Modules\Admin\Forms
 * @link https://code.google.com/p/knihovna/
 */

class Admin_Form_AddResource extends Zend_Form
{

    /**
     * Inicializuje formulář
     *
     * @author Petr Laslo
     */
    public function init()
    {
        $resources = new Knihovna_Model_DbTable_Usersresources();
        $resourceslist = $resources->fetchArray();

        $resource     = new Zend_Form_Element_Text('resource',
            array('size'     => 15,
                'maxlength'=> 20,
                'label'    => 'Zdroj',
                'require'  => true));

        $parent = new Zend_Form_Element_Select ('parent');
        $parent->setLabel('Rodič');
        $parent->setMultiOptions($resourceslist);


        $send = new Zend_Form_Element_Submit('submit_add','Přidat');

        $resource->addValidator('NotEmpty',true);


        $resource->addFilter('StringTrim');
        $resource->addFilter('StripTags');

        $this->addElements(array($resource, $parent, $send));
    }
}

